<template>
  <div id="app">
    <el-container class="main-container">
      <el-header height="60px" v-if="!isChat">
        <div class="header-content">
          <h1>博识智库</h1>
          <div class="nav-buttons">
            <el-button type="text" @click="$router.push('/')">回到聊天</el-button>
            <el-button type="text" @click="$router.push('/knowledge')">知识库</el-button>
            <el-button type="text" @click="$router.push('/settings')">设置</el-button>
          </div>
        </div>
      </el-header>
      
      <!-- 聊天页面使用全屏布局 -->
      <template v-if="isChat">
        <router-view />
      </template>
      
      <!-- 其他页面使用带标题栏的布局 -->
      <template v-else>
        <el-main>
          <router-view />
        </el-main>
      </template>
    </el-container>
  </div>
</template>

<script>
import { computed } from 'vue'
import { useRoute } from 'vue-router'

export default {
  name: 'App',
  setup() {
    const route = useRoute()
    
    // 判断当前是否是聊天页面
    const isChat = computed(() => {
      return route.name === 'Chat'
    })
    
    return {
      isChat
    }
  }
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  overflow: hidden;
}

#app {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-container {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.el-header {
  background-color: #409EFF;
  color: white;
  display: flex;
  align-items: center;
}

.header-content {
  width: 100%;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-buttons .el-button {
  color: white;
  margin-left: 15px;
}

.nav-buttons .el-button:hover {
  color: #f0f9ff;
}

.el-main {
  background-color: #f5f7fa;
  height: calc(100vh - 60px);
  padding: 20px;
  width: 100%;
}
</style> 